# Copyright [2011] [Ilya Rudakov]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from job_manager.utils.code_gen import CodeGenerator

__author__ = 'irudakov'

def handle_python_job(feed_path):
    handle_python_settings(feed_path)

def handle_python_settings(feed_path):
    f_settings = open(feed_path + "/settings.py", "w")
    code_gen = CodeGenerator()
    code_gen.begin(tab = "    ")
    code_gen.write("SETTINGS = {")
    code_gen.newline()
    code_gen.indent()
    code_gen.write("'logs_path':'%s/logs'," % os.path.abspath(feed_path))
    code_gen.newline()
    code_gen.dedent()
    code_gen.write("}")

    f_settings.write(code_gen.end())
    f_settings.close()
    del code_gen
  